version 14.0
log using "\Users\sgolder\Dropbox\Portfolio Allocation\replication\ariottigolder-descriptive1.log", replace
set more off
#delimit ;

*     ***************************************************************** *;
*     ***************************************************************** *;
*       File-Name:      ariotti_golder-descriptive1.do                  *;
*       Date:           September 9, 2016                               *;
*       Author:         Molly Ariotti and Sona Golder                   *;
*       Purpose:      	Get some descriptive data.                      *;
* 	    Input File:     Africa_govt_obs.dta                             *;
*       Output File:    ariottigolder-descriptive1.log                  *;
*       Data Output:    Africa_govt_descriptive.dta                     *;             
*       Previous file:  Africa_govt_obs.xls --> Stata .dta              *;
*       Machine:        laptop                           				*;
*     ****************************************************************  *;
*     ****************************************************************  *;

*     ****************************************************************  *;
*       Open and summarize dataset. Generate some variables.            *;
*     ****************************************************************  *;

use "C:\Users\sgolder\Dropbox\Portfolio Allocation\replication\Africa_govt_obs.dta";

*     ****************************************************************  *;
*       Label variables                                                 *;
*     ****************************************************************  *;

label var name "country name";
label var democraticyears "years country is democratic during 1990-2014";
label var cabinet "cabinet code";
label var cabinetdates "date in and date out of cabinet";
label var legislativeelection "date of previous legislative election";
label var presidentialelection "date of previous presidential election";
label var postelection "1 if govt forms following election, 0 otherwise";
label var govtcoalition "1 if govt is coalition, 0 otherwise";
label var cangetdata "1 = can get complete partisan portfolio information (if coalition), 0 = otherwise";
label var regimetype "0=parl, 1= semi-pres, 2=pres"; 
label var govt_size "number of portfolios in the government";

sum;
desc;

*     ****************************************************************  *;
*       Identify countries with coalitions, data                        *;
*     ****************************************************************  *;

list name if govtcoalition==1;
list name if cangetdata==1;

*     ****************************************************************  *;
*      Get total number of governments that are coalitions, total       *;
*       number of governments that formed after an election, total      *;
*       number of governments that are single party, and total number   *;
*       of coalition governments for which we have full partisan        *;
*       portfolio allocation data                                       *;
*     ****************************************************************  *;

sum govtcoalition if govtcoalition==1;
sum govtcoalition if govtcoalition==0;

sum govtcoalition if postelection==0;
sum govtcoalition if postelection==1;

sum govtcoalition if postelection==0 & govtcoalition==1;
sum govtcoalition if postelection==1 & govtcoalition==1;

sum govtcoalition if govtcoalition==1 & cangetdata==1;
sum govtcoalition if govtcoalition==1 & cangetdata==0;

*     ****************************************************************  *;
*       Identify numbers of parl (regimetype 0 or 1) and pres govts,    *;
*       (regimetype 2) and by govt type (coalition or single party)     *;
*     ****************************************************************  *;

sum govtcoalition if regimetype==0;
sum govtcoalition if regimetype==1;
sum govtcoalition if regimetype==2;

sum govtcoalition if govtcoalition==1 & regimetype==0;
sum govtcoalition if govtcoalition==1 & regimetype==1;
sum govtcoalition if govtcoalition==1 & regimetype==2;

sum govtcoalition if govtcoalition==0 & regimetype==0;
sum govtcoalition if govtcoalition==0 & regimetype==1;
sum govtcoalition if govtcoalition==0 & regimetype==2;

*     ****************************************************************  *;
*       Get descriptive statistics about govt size                      *;
*       Check that govt_size variable only relevant for coalitions      *;
*       (missing data otherwise, b/c we didn't check govt sizes for     *;
*       single-party govts                                              *;
*     ****************************************************************  *;

sum govt_size;
sum govt_size if govtcoalition==1;

sum govt_size if cangetdata==1;
sum govt_size if cangetdata==0;

ttest govt_size, by(cangetdata);

save "C:\Users\sgolder\Dropbox\Portfolio Allocation\replication\Africa_govt_descriptive.dta", replace;

log close;
exit;
